/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Public License. A 
 * copy of the license can be found in the License.html file at the root of this distribution. If 
 * you cannot locate the  Microsoft Public License, please send an email to 
 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Public License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
 * PARTICULAR PURPOSE.
 * ***************************************************************************/



#if !defined(AFX_PGLPOLYGONMARKER_H__A9F70A83_23EC_4CC5_80EA_5659B1F460B2__INCLUDED_)
#define AFX_PGLPOLYGONMARKER_H__A9F70A83_23EC_4CC5_80EA_5659B1F460B2__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <pgl/core/PGLMarker.h>
#include <pgl/core/PGLDataVectors.h>

/*! \brief A generic polygon marker


\ingroup PGLMarkerGroup
*/
class PGLCORE_EXT_CLASS CPGLPolygonMarker : public CPGLMarker  
{
PGL_DECLARE_DYNCREATE(CPGLPolygonMarker);
public:
	//! \name Constructors
	//@{
	//! Default constructor
	CPGLPolygonMarker(const CPGLColor& _color=CPGLColor(), const CPGLColor& _FillColor=CPGLColor(1,1,1,1));
	//! Copy constructor
	CPGLPolygonMarker(const CPGLPolygonMarker& p){*this = p;};
	//! Assignement constructor
	CPGLPolygonMarker& operator = (const CPGLPolygonMarker& p);
	virtual ~CPGLPolygonMarker();
	//@}

	//! Polygon description
	//@{
	//! setting normalized corner positions
	void SetDatas( CPGLDataPtr pXs, CPGLDataPtr pYs);
	//! delete data
	void ClearData();
	//! retreive x positions
	CPGLDataPtr GetCornersX()								{	return m_pCornerX;};
	//! retreive y positions
	CPGLDataPtr GetCornersY()								{	return m_pCornerY;};
	//! open or closed curve
	void SetClosed( bool bClosed = true)				{	m_bClosed = bClosed;};
	//! return true if curve is closed
	bool IsClosed() const								{	return m_bClosed;};
	//! update temporary vectors
	void UpdateCorners(double radius);
	//@}

	//! \name Plotting functions
	//@{
	//! Main plotting function
	void PlotGfx(gfxinterface::CGfxInterface& gfx, CPGLDataPtr pDataX, CPGLDataPtr pDataY);
	//! Legend plotting
	void PlotLegendGfx(gfxinterface::CGfxInterface& gfx, float x, float y);
	//! returns linetype
	virtual DWORD GetLineType() const;
	//@}

	//! \name Serialize functions
	//@{
	//! Serialiation to XML
	void SerializeXML(CPGLArchive& ar);

	//! Debuggin functions
	#ifdef _DEBUG
		//! MFC Dump
	    virtual void Dump( CDumpContext& dc ) const;
		//! MFC AssertValid
	    virtual void AssertValid() const;   
	#endif
	//@}

protected:

	//! \name Attributes
	//@{
	//! x positions
	CPGLDataPtr m_pCornerX;
	//! y positions
	CPGLDataPtr m_pCornerY;
	//! closed/open bit
	bool m_bClosed;
	//@}
private:
	CPGLVectorF m_vCornerX;
	CPGLVectorF m_vCornerY;
};

PGL_DECLARE_SMARTPTR( CPGLPolygonMarker );

#endif // !defined(AFX_PGLPOLYGONMARKER_H__A9F70A83_23EC_4CC5_80EA_5659B1F460B2__INCLUDED_)
